function myAjax(method, url, data) {
    return new Promise((resolve, reject) => {
        var xhr = new XMLHttpRequest()
        xhr.open(method, url)
        xhr.send(data)
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4 && xhr.status >= 200 && xhr.status < 300) {
                resolve(xhr.response)
            } else {
                reject('获取数据失败')
            }
        }
    })
}